package ss;

import Herotestw.KamenRider;
import Herotestw.Ultraman;

//我是一个父类
public class Hero {
    private  String name;
    private int age;
    private int fightpower;
    private int defendpower;
    private String superpower;
    //
    private boolean standpoint;
    public String maincolor;
    public String typelike ;
    //多态的尝试
    public String hero = "英雄";//父类将会被隐藏覆盖的实例变量
    public void togetherProtect(){
        System.out.println("共同的守护 //Mark：父类普通方法" );
    }
    public void heroProtect(){
        System.out.println("英雄的守护 //Mark：父类将会被覆盖的方法");
    }
    public void connection(){
        System.out.println("梦幻联动");
    }

    public Hero(String name){
        this.name = name;
    }

    public Hero(){

    }
    public Hero(String name, int age, int fightpower, int defendpower, String superpower,boolean standpoint, 
    String maincolor, String typelike) {
        this.name = name;
        this.age = age;
        this.fightpower = fightpower;
        this.defendpower = defendpower;
        this.superpower = superpower;
        this.standpoint = standpoint;
        this.maincolor = maincolor;
        this.typelike = typelike;
    }

    public void setHeroInfo(String inputn, int inputa) {
        // Scanner input = new Scanner(System.in);
        name = inputn;
        age = inputa;
    }

    public void getHeroInfo() {
        System.out.println("英雄名： " + name);
        System.out.println("年龄： " + age);
    }

    protected void setPower(int inputf, int inputd, String inputs) {
        fightpower = inputf;
        defendpower = inputd;
        superpower = inputs;
    }

    protected void getPower() {
        System.out.println("攻击力： " + fightpower);
        System.out.println("防御力： " + defendpower);
        System.out.println("技能： " + superpower);
    }

    protected int returnFightpower(){
        return fightpower;
    }

    protected int returnDefendpower(){
        return defendpower;
    }

    public void target() {
        //提高重写方法的访问权限
        System.out.println("守望和平");
    }
    
    //Final关键词的使用
    // 1. 不可被重写的方法
    public final void sharedGoal(){
        System.out.println("热爱 反战 正义 和平");
    }
    //2. 最终类
    //3. 不可变类

    //重写object类方法实验
    //1. toString方法重写
    public void setShow(int loads,String inputm,String inputt){
        if(loads == 1){
            standpoint = true;
        }
        else if (loads == 0){
            standpoint = false;
        }
        else{
            System.out.println("错误");
        }
        maincolor = inputm;
        typelike = inputt;
    }

    public String toString(){
        return "立场[" + standpoint + "] 形态[" + typelike + "] 主色调[" + maincolor+"]";
    }
    
    //2. toequeals方法重写
    public boolean equals(Object obj){
        if(obj instanceof Hero){//不能用结合律
            Hero hilo = (Hero) obj;
            int hf = hilo.returnFightpower();
            int hd = hilo.returnDefendpower();
            if(this.fightpower == hf && this.defendpower == hd && this.maincolor == hilo.maincolor && this.typelike == hilo.typelike){
                return true;
            }
            else{
                return false;
            }
        }
        else{
            return false;
        }
    }

    }